package model;

import java.sql.Date;

public class Log implements Comparable<Log> {

	private User user;
	private Date date;
	private int pageID;
	private String IPaddress;
	private String path;
	private int count;
	
	public Log(User user, Date date, int pageID, String IPaddress, String path, int count){
		super();
		this.user = user;
		this.date = date;
		this.pageID = pageID;
		this.IPaddress = IPaddress;
		this.path = path;
		this.count = count;
	}
	public Log(Date date, int pageID, String IPaddress, String path, int count){
		super();

		this.date = date;
		this.pageID = pageID;
		this.IPaddress = IPaddress;
		this.path = path;
		this.count = count;
	}
	
	public Log(Date date, int count) {
		this.date = date;
		this.count = count;
	}
	public Log(User user, int pageID, String IPaddress, int count) {
		this.user = user;
		this.pageID = pageID;
		this.IPaddress = IPaddress;
		this.count = count;
	}
	public Log(User user, Date date, int pageID, String IPaddress, int count) {
		this.user = user;
		this.date = date;
		this.pageID = pageID;
		this.IPaddress = IPaddress;
		this.count = count;
	}
	public User getUser(){
		return user;
	}
	
	public Date getDate(){
		return date;
	}
	
	public int getPageID(){
		return pageID;
	}
	public int getCount(){
		return count;
	}
	
	public String getIPaddress(){
		return IPaddress;
	}
	
	public String getPath(){
		return path;
	}
	public String toString(){
		return user + " " + date + " " + pageID + " " + IPaddress;
	}
	public int compareTo(Log compareLog) {
		 
		int compareCount = ((Log) compareLog).getCount(); 
 
		//ascending order
		//return this.count - compareCount;
 
		//descending order
		return compareCount - this.count;
 
	}
 
}
